package com.ruoyi.web.controller.item;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.item.domain.ItemTaoteId;
import com.ruoyi.item.service.IItemTaoteIdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 陶特ID结算Controller
 * 
 * @author ruoyi
 * @date 2022-03-23
 */
@Api("陶特ID结算Controller")
@RestController
@RequestMapping("/item/taoteid")
public class ItemTaoteIdController extends BaseController
{
    @Autowired
    private IItemTaoteIdService itemTaoteIdService;

    /**
     * 查询陶特ID结算列表
     */
    @ApiOperation("查询陶特ID结算列表")
    @PreAuthorize("@ss.hasPermi('item:taoteid:list')")
    @GetMapping("/list")
    public TableDataInfo list(ItemTaoteId itemTaoteId)
    {
        startPage();
        List<ItemTaoteId> list = itemTaoteIdService.selectItemTaoteIdList(itemTaoteId);
        return getDataTable(list);
    }

    /**
     * 导出陶特ID结算列表
     */
    @ApiOperation("导出陶特ID结算列表")
    @PreAuthorize("@ss.hasPermi('item:taoteid:export')")
    @Log(title = "陶特ID结算", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ItemTaoteId itemTaoteId)
    {
        List<ItemTaoteId> list = itemTaoteIdService.selectItemTaoteIdList(itemTaoteId);
        ExcelUtil<ItemTaoteId> util = new ExcelUtil<ItemTaoteId>(ItemTaoteId.class);
        util.exportExcel(response, list, "陶特ID结算数据");
    }

    /**
     * 获取陶特ID结算详细信息
     */
    @ApiOperation("获取陶特ID结算详细信息")
    @PreAuthorize("@ss.hasPermi('item:taoteid:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(itemTaoteIdService.selectItemTaoteIdById(id));
    }

    /**
     * 新增陶特ID结算
     */
    @ApiOperation("新增陶特ID结算")
    @PreAuthorize("@ss.hasPermi('item:taoteid:add')")
    @Log(title = "陶特ID结算", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ItemTaoteId itemTaoteId)
    {
        return toAjax(itemTaoteIdService.insertItemTaoteId(itemTaoteId));
    }

    /**
     * 修改陶特ID结算
     */
    @ApiOperation("修改陶特ID结算")
    @PreAuthorize("@ss.hasPermi('item:taoteid:edit')")
    @Log(title = "陶特ID结算", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ItemTaoteId itemTaoteId)
    {
        return toAjax(itemTaoteIdService.updateItemTaoteId(itemTaoteId));
    }

    /**
     * 删除陶特ID结算
     */
    @ApiOperation("删除陶特ID结算")
    @PreAuthorize("@ss.hasPermi('item:taoteid:remove')")
    @Log(title = "陶特ID结算", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(itemTaoteIdService.deleteItemTaoteIdByIds(ids));
    }
}
